"""
功能描述 ：
编写人 ：
编写日期 ：
实现逻辑 ：
    1- ......
        1.1- ......
    2- ......
        2.1- ......
"""
#查看数据类型
# a = 1
# print(type(a))
# b = 1.2
# print(type(b))
# c = '1,2,3,4'
# print(type(c))
# d = (1,2,3,4)
# print(type(d))
# e = [1,2,3,4]
# print(type(e))
# f = {1,2,3,4}
# print(type(f))
#数据类型转换
# list1 = [10, 20, 30]
# print(tuple(list1))
# print(type(tuple(list1)))
#--------------------------字符串操作
# str1 = "hello world and superctest and chaoge and python"
#下标
# print(str1[0])
# #查找
# print(str1.find('and'))
# print(str1.rfind("and"))
# #
# print(str1.index('and',15,30))
# print(str1.rindex("and"))
#count统计子串在真个字符串出现次数
# print(str1.count('and'))
# #替换
# print(str1.replace('and','or'))
# #字符串分割
# print(str1.split('hellow'))
# print(str1.split('and',3))
# print(str1.split(' '))
# print(str1.split(' ',3))
# #字符串拼接
# s2 = 'longtengsihai'
# print('*'.join(s2))
#capitalize()：将字符串第⼀个字符转换成⼤写
# str1 = "hello world and superctest and chaoge and python"
# print(str1.capitalize())
# #title()：将字符串每个单词⾸字⺟转换成⼤写。
# print(str1.title())
#lower()：将字符串中⼤写转⼩写
# str1 = "Hello world and superctest and chaoge and python"
# print(str1.lower())
#upper()：将字符串中⼩写转⼤写。
# print(str1.upper())
#lstrip()：删除字符串左侧空⽩字符。
#字符串空白删除
#lstrip()：删除字符串左侧空⽩字符
# str1 = "   Hello world and superctest and chaoge and python   "
# print(str1.lstrip())
# #rstrip()：删除字符串右侧空⽩字符
# print(str1.rstrip())
# #strip()：删除字符串两侧空⽩字符。
# print(str1.strip())
# #ljust()：返回⼀个原字符串左对⻬,并使⽤指定字符(默认空格)填充⾄对应⻓度 的新字符串
# mystr = "hellow"
# print(mystr.ljust(10,'.'))
# #rjust()：返回⼀个原字符串右对⻬,并使⽤指定字符(默认空格)填充⾄对应⻓度 的新字符串
# print(mystr.rjust(10,'*'))
# #center()：返回⼀个原字符串居中对⻬,并使⽤指定字符(默认空格)填充⾄对应⻓度 的新字符串
# print(mystr.center(10,'*'))
#startswith()：检查字符串是否是以指定⼦串开头，是则返回 True，否则返回 False
# mystr1 = "Hello world and superctest and chaoge and python"
# print(mystr1.startswith("Hello"))
# print(mystr1.startswith("11"))
# #endswith()：：检查字符串是否是以指定⼦串结尾，是则返回 True
# print(mystr1.endswith("python"))
# print(mystr1.endswith(11))
#isalpha()：如果字符串⾄少有⼀个字符并且所有字符都是字⺟则返回 True, 否则返回 False。
# mystr1 = "Hello world and superctest and chaoge and python"
# mystr2 = '12345'
#
# print(mystr1.isalpha())
# print(mystr2.isalpha())
#isdigit()：如果字符串只包含数字则返回 True 否则返回 False
# mystr = "12345"
# print(mystr.isdigit())
# mystr = "1,2,3,4,5"
# print(mystr.isdigit())
#
# #isalnum()：如果字符串⾄少有⼀个字符并且所有字符都是字⺟或数字则返 回 True,否则返回Falsh
# mystr1 = 'aaa12345'
# mystr2 = '12345-'
# print(mystr1.isalnum())
# print(mystr2.isalnum())
# #isspace()：如果字符串中只包含空⽩，则返回 True，否则返回 False。
# mystr1 = '1 2 3 4 5'
# mystr2 = ' '
# print(mystr1.isspace())
# print(mystr2.isspace())
#————————————————————————————————条件语句——————————————————————————————
#初版年龄判断上网

# age = 18
# if age >= 18:
#     print('可以上网')
# print('系统关闭')

# age = int(input("请输入年龄："))
# if age >= 18:
#     print(f'年龄是{age},已经成年可以上网')
# else:
#     print(f"年龄是{age},不可以上网")
# print('系统关闭')
#多重判断
# age = int(input('请输入年龄:'))
# if age <= 18:
#     print(f'年龄是{age}岁，未成年')
# elif age >= 18 and age <= 60:
#     print(f'年龄是{age},合法')
# elif age >=60:
#     print(f'年龄是{age},该退休啦')1
# #if嵌套
# money = int(input('请投币:'))
# seat = int(input('座位为:'))
# if money == 1 and seat > 0:
#     print(f'投币{money}元，座位{seat}请坐')
#     elif print(f'座位{seat}请坐')
# elif seat < 0:
#     print(f'座位{seat}站一路')
# else:
#     print(f'投币{money}元，下车吧')
# #猜拳游戏
#
# import random
# computer = random.randint(0,2)
# print(computer)
# player = int(input('请出拳：0-⽯头，1-剪⼑，2-布：'))
#
# if player == 0 and computer == 1 or player == 1 and computer == 2 or player == 2 and computer == 0:
#     print('玩家获胜')
# elif player == computer:
#     print('平局')
# else:
#     print('电脑获胜')

#————----------------循环-----------------------
# #while循环
# a = 1
# while a <10:
#     print(a)
#     a +=1
# print('结束')
# #计算1-100累加和
# i = 1
# sum = 0
# while i <100:
#     sum +=i
#     i += 1
# print(sum)
# #计算1-100偶数累加和
# i = 1
# sum = 0
# while i <100:
#     if i % 2 == 0:
#         sum +=i
#     i += 1
# print(sum)
#break：停止循环
'''i = 1
while i < 5:
    if i == 3:
        print('够啦')
        break
    print(f'吃了{i}个苹果')
    i += 1'''
#comtinue：停止上一个循环，继续执行下一个
'''i = 1
while i <= 5:
    if i == 3:
        print('有虫子，不吃啦')
        i += 1
        continue
    print(f'吃了{i}个苹果')
    i += 1'''
#while循环嵌套
'''j = 0
while j <= 3:
    i = 0
    while i <= 3:
        print('我错啦')
        i +=1
    print('洗衣服')
    print('一套-------------')
    j += 1'''
# #for循环
# str1 = 'cehnyusong'
# for i in str1:
#     if i == 'e':
#         print('遇到e不打印')
#         break
#     print(i)
# #
# tr1 = 'cehnyusong'
# for i in str1:
#     if i == 'e':
#         print('遇到e不打印')
#         continue
#     print(i)
#while...else
# i = 1
# while i <= 5:
#     print('媳妇⼉，我错了')
#     i += 1
# else:
#     print('媳妇原谅我了，真开⼼，哈哈哈哈')
#break
# i = 1
# while i <= 5:
#     if i == 2:
#         print('这遍说的不真诚')
#         break
#     print('我错了')
#     i += 1
# else:
#     print('真开⼼，哈哈哈哈')
#comtiune
i = 1
while i <= 5:
    if i == 3:
        print('这遍说的不真诚')
    continue
    i += 1
    print('媳妇⼉，我错了')
    i += 1
else:
    print('媳妇原谅我了，真开⼼，哈哈哈哈')

#for...else
str1 = 'hello'
for i in str1:
    print(i)
else:
    print('循环正常结束之后执⾏的代码')

#打印三角形
# 重复打印5⾏星星
# j表示⾏号
j = 0
while j <= 4:
    i = 0
# i表示每⾏⾥⾯星星的个数，这个数字要和⾏号相等所以i要和j联动
while i <= j:
    print('*', end='')
    i += 1
print()
j += 1
#九九乘法表
for i in range(10):
    for j in range(1,i+1):
        print(f'{j}x{i}={i * j}\t', end='')
    print()

